﻿@model List<HPIT.RentHouse.DTO.HousePicDTO>
@{
    ViewBag.Title = "LookPicture";
    Layout = "~/Views/Shared/_Layout1.cshtml";
}
<link href="~/Content/h-ui/lib/lightbox2/2.8.1/css/lightbox.css" rel="stylesheet" />
<form action="@Url.Action("DeleteBatchPics","House")" method="post" class="form form-horizontal" id="form-admin-add">
    <div class="pd-20">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="l">
                <a href="javascript:;" id="btn_DeleteBatch" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
            </span>
            <span class="r">共有数据：<strong>@Model.Count</strong>条</span>
        </div>
        <div class="portfolio-content">
            <ul class="cl portfolio-area">
                @foreach (var item in Model)
                {
                    <li class="item">
                        <div class="portfoliobox">
                            <input class="checkbox" name="selectIDs" value="@item.Id" type="checkbox">
                            <div class="picbox"><a href="@item.Url" data-lightbox="gallery"><img src="@item.ThumbUrl"></a></div>
                        </div>
                    </li>
                }
            </ul>
        </div>
    </div>
</form>

@section footScript{
    <script src="~/Content/h-ui/lib/lightbox2/2.8.1/js/lightbox.min.js"></script>
    <script type="text/javascript">
        //实例化灯箱
        $(function () {
            $.Huihover(".portfolio-area li");
        });
         //批量删除
        $('#btn_DeleteBatch').click(function () {
             //声明一个数组来接收用户勾选的复选框id
            var ids = [];
            $(":checkbox[name='selectIDs']:checked").each(function () {
                var id = $(this).val();
                ids.push(id);
            })
            //若用户没有勾选任何项
            if (ids.length == 0) {
                layer.msg("请选择要删除的项");
                return;
            }
            layer.confirm('确认是否删除?', { icon: 3, title: '提示' }, function () {
                $.post("@Url.Action("DeleteBatchPics", "House")", { picId: ids }, function (data) {
                    if (data.State == 1) {
                        location.reload();
                    }
                    else {
                        layer.msg(data.ErrorMessage, { icon: 2 });
                    }
                })
            });
        })
    </script>
}
